package com.api.league.dao;

import com.api.core.ApiMapper;
import com.api.league.model.LeagueStanding;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * @author RenQiang
 * @date 2021/5/30
 */
@Mapper
public interface LeagueStandingMapper extends ApiMapper<LeagueStanding> {
    /**
     * 批量保存或更新Standing
     * 比赛日+战队已存在记录时则累加数据
     *
     * @param leagueStandings
     * @return
     */
    int saveOrUpdateStandings(@Param("leagueStandings") List<LeagueStanding> leagueStandings);

    /**
     * 根据联赛ID查询Standing
     *
     * @param leagueId
     * @param beginDate
     * @param endDate
     * @return
     */
    List<LeagueStanding> findMatchDayStandingByPage(@Param("leagueId") Long leagueId, @Param("beginDate") Date beginDate, @Param("endDate") Date endDate);

    /**
     * 根据联赛ID查询战队总Standing
     *
     * @param leagueId
     * @return
     */
    List<LeagueStanding> findTeamStandingByPage(@Param("leagueId") Long leagueId);

    void deleteByLeagueId(@Param("leagueId") Long leagueId);
}
